package com.hurl.waguji.biz.schedule;

import org.quartz.Job;
import org.quartz.JobDataMap;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;

import com.hurl.waguji.base.dataprocess.ProcessException;

public class ProcessJob implements Job {
	@Override
	public void execute(JobExecutionContext context)
			throws JobExecutionException {
		JobDataMap dataMap = context.getMergedJobDataMap();
		ProcessJobDetail detail = (ProcessJobDetail)dataMap.get(ScheduleService.KEY_PARAM_DETAIL);
		if(detail==null){
			throw new JobExecutionException("缺少参数："+ScheduleService.KEY_PARAM_DETAIL);
		}
		try {
			detail.getIdentifier().execute(detail.getParams());
		} catch (ProcessException e) {
			e.printStackTrace();
			throw new JobExecutionException(e);
		}
	}
	
}
